package com.unlcn.ils.kas.scheduled;

import com.unlcn.ils.kas.service.constant.CronConstant;
import com.unlcn.ils.kas.service.order.HoldingOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 江铃控股订单调度
 * @author 罗必量
 */
@Component
public class HoldingOrderScheduled {

    private static final Logger LOGGER = LoggerFactory.getLogger(HoldingOrderScheduled.class);

    @Autowired
    private HoldingOrderService holdingOrderService;

    /**
     * 拉取控股订单 定时任务 1
     */
    //@Scheduled(cron = CronConstant.HOLDING_CRON1)
    public void getOrder1() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        LOGGER.info(simpleDateFormat.format(new Date()) + "拉取控股订单调度1 start ====================");

        holdingOrderService.pushOrder1();

        LOGGER.info(simpleDateFormat.format(new Date()) + "拉取控股订单调度1 end ====================");
    }

    /**
     * 拉取控股订单 定时任务 2
     */
    //@Scheduled(cron = CronConstant.HOLDING_CRON2)
    public void getOrder2() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        LOGGER.info(simpleDateFormat.format(new Date()) + "拉取控股订单调度2 start ====================");

        holdingOrderService.pushOrder2();

        LOGGER.info(simpleDateFormat.format(new Date()) + "拉取控股订单调度2 end ====================");
    }
}
